//
// Created on 2025/7/31.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef MYAPPLICATION_JS_UTILS_H
#define MYAPPLICATION_JS_UTILS_H
#include "napi/native_api.h"
#include <string>

std::string JsToString(napi_env env, napi_value value);
int32_t JsToInt32(napi_env env, napi_value value);
uint64_t JsToInt64(napi_env env, napi_value value); //这里从int64_t转成了uint64_t，可能有问题
float JsToFloat(napi_env env, napi_value value);
bool JsToBool(napi_env env, napi_value value);
int32_t GetFd(napi_env env, napi_value value);

napi_value ToJsString(napi_env env, const std::string& value);
napi_value ToJsInt(napi_env env, int32_t value);
napi_value ToJsInt(napi_env env, uint64_t value);
napi_value ToJsUndefined(napi_env env);
napi_value ToJsFloat(napi_env env, float value);

void CallProcess(napi_env env, napi_value func, napi_value thisArg, float progress);
void CallEnd(napi_env env, napi_value func, napi_value thisArg);
#endif //MYAPPLICATION_JS_UTILS_H
